package com.action.boot.jpa.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * Created by Wuxiang on 2017/3/25.
 */
public interface UserInfoRepository extends CrudRepository<UserInfo,Long> {

    List<UserInfo> findByName(String name);  //findBy***   （***实体类的名称） 自动生成sql

    @Query(value = "select * from user where age is null",nativeQuery = true)
    List<UserInfo> findAgeNull();

    @Query(value = "select * from user where age= ?1",nativeQuery = true)
    List<UserInfo> findByAge(String age);
}
